﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using SmesharikiMVC.Models.VideoCollection;

namespace SmesharikiMVC.Areas.Admin.Controllers
{
    [OutputCache(Location = OutputCacheLocation.None, NoStore = true)]
    public class ValidationController : Controller
    {

        private VideoCollectionContext db = new VideoCollectionContext();

        public JsonResult CheckAlbumName(string Albumname)
        {
            var result = db.Albums.FirstOrDefault(v => v.AlbumName == Albumname) == null;
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        public JsonResult CheckVideoName(string Videotitle)
        {
            var result = db.Videos.FirstOrDefault(v => v.VideoTitle == Videotitle) == null;
            return Json(result, JsonRequestBehavior.AllowGet);
        }
        
    }
}
